package com.example.myspringframework.test;

import com.example.myspringframework.beans.factory.BeanFactory;
import com.example.myspringframework.beans.BeansException;
import com.example.myspringframework.beans.factory.BeanFactoryAware;
import com.example.myspringframework.context.ApplicationContext;
import com.example.myspringframework.context.ApplicationContextAware;

public class UserService implements BeanFactoryAware, ApplicationContextAware {
    private BeanFactory beanFactory;
    private ApplicationContext applicationContext;
    private User user;

    public User getUser() {
        return user;
    }

    public void findById() {
        System.out.println("user1111");
    }

    public void setUser(User user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "UserService{" +
                "beanFactory=" + beanFactory +
                ", applicationContext=" + applicationContext +
                ", user=" + user +
                '}';
    }

    @Override
    public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
        this.beanFactory = beanFactory;
    }

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}
